<template>
    <tab-content>
        <template v-slot:breadcrumbPanel>
            <el-breadcrumb separator-class="el-icon-arrow-right">
                <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
                <el-breadcrumb-item>活动管理</el-breadcrumb-item>
                <el-breadcrumb-item>活动列表</el-breadcrumb-item>
                <el-breadcrumb-item>活动详情</el-breadcrumb-item>
            </el-breadcrumb>
        </template>
        <template v-slot:searchPanel>
            <el-row :gutter="20">
                <el-col :span="5">
                    <el-input size="mini" placeholder="请输入内容" v-model="input1" clearable></el-input>
                </el-col>
                <el-col :span="5">
                    <el-input label="用户名" size="mini" placeholder="请输入内容" v-model="input2" clearable></el-input>
                </el-col>
                <el-col :span="5">
                    <el-input label="用户名" size="mini" placeholder="请输入内容" v-model="input3" clearable></el-input>
                </el-col>
                <el-col :span="5">
                    <el-input label="用户名" size="mini" placeholder="请输入内容" v-model="input4" clearable></el-input>
                </el-col>
                <el-col :span="4">
                    <el-tooltip :content="showMoreSearch?'关闭':'展开'" placement="bottom" effect="light">
                        <el-button size="mini" @click="onShowMoreSearchClick"
                                   :icon="showMoreSearch?'el-icon-minus':'el-icon-plus'"></el-button>
                    </el-tooltip>
                </el-col>
            </el-row>
            <el-collapse-transition>
                <div v-show="showMoreSearch">
                    <el-row :gutter="20">
                        <el-col :span="5">
                            <el-input size="mini" placeholder="请输入内容" v-model="input1" clearable></el-input>
                        </el-col>
                        <el-col :span="5">
                            <el-input label="用户名" size="mini" placeholder="请输入内容" v-model="input2" clearable></el-input>
                        </el-col>
                        <el-col :span="5">
                            <el-input label="用户名" size="mini" placeholder="请输入内容" v-model="input3" clearable></el-input>
                        </el-col>
                        <el-col :span="5">
                            <el-input label="用户名" size="mini" placeholder="请输入内容" v-model="input4" clearable></el-input>
                        </el-col>
                    </el-row>
                    <el-row :gutter="20">
                        <el-col :span="5">
                            <el-input size="mini" placeholder="请输入内容" v-model="input1" clearable></el-input>
                        </el-col>
                        <el-col :span="5">
                            <el-input label="用户名" size="mini" placeholder="请输入内容" v-model="input2" clearable></el-input>
                        </el-col>
                        <el-col :span="5">
                            <el-input label="用户名" size="mini" placeholder="请输入内容" v-model="input3" clearable></el-input>
                        </el-col>
                        <el-col :span="5">
                            <el-input label="用户名" size="mini" placeholder="请输入内容" v-model="input4" clearable></el-input>
                        </el-col>
                    </el-row>
                </div>
            </el-collapse-transition>
            <el-row class="oy-right">
                <el-button size="mini" type="primary" icon="el-icon-arrow-left">上一页</el-button>
                <el-button size="mini" type="primary">下一页<i class="el-icon-arrow-right el-icon--right"></i>
                </el-button>
                <el-button size="mini" type="primary" icon="el-icon-edit"></el-button>
                <el-button size="mini" type="primary" icon="el-icon-share"></el-button>
                <el-button size="mini" type="primary" icon="el-icon-delete"></el-button>
            </el-row>
        </template>
        <template v-slot:tablePanel>
            <el-table
                    :data="tableData" border
                    :row-style="{height:'30px'}"
                    :cell-style="{padding:'3px'}"
                    style="width: 100%">
                <el-table-column
                        fixed
                        prop="date"
                        label="日期"
                        width="150">
                </el-table-column>
                <el-table-column
                        prop="name"
                        label="姓名"
                        width="120">
                </el-table-column>
                <el-table-column
                        prop="province"
                        label="省份"
                        width="120">
                </el-table-column>
                <el-table-column
                        prop="city"
                        label="市区"
                        width="120">
                </el-table-column>
                <el-table-column
                        prop="address"
                        label="地址"
                        width="300">
                </el-table-column>
                <el-table-column
                        prop="zip"
                        label="邮编"
                        width="120">
                </el-table-column>
                <el-table-column
                        fixed="right"
                        label="操作"
                        width="100">
                    <template slot-scope="scope">
                        <el-button @click="handleClick(scope.row)" type="text" size="small">查看</el-button>
                        <el-button type="text" size="small">编辑</el-button>
                    </template>
                </el-table-column>
            </el-table>
            <div class="tab-content-table-pagination">
                <el-pagination
                        @size-change="handleSizeChange"
                        @current-change="handleCurrentChange"
                        :current-page="currentPage4"
                        :page-sizes="[100, 200, 300, 400]"
                        :page-size="100"
                        layout="total, sizes, prev, pager, next, jumper"
                        :total="400">
                </el-pagination>
            </div>
        </template>
    </tab-content>
</template>

<script>

    import TabContent from "@/components/tabs/TabContent";

    export default {
        name: "RoleList",
        components: {
            TabContent
        },
        methods: {
            onShowMoreSearchClick() {
                this.showMoreSearch = !this.showMoreSearch
            },
            handleClick(row) {
                console.log(row);
            },
            handleSizeChange(val) {
                console.log(`每页 ${val} 条`);
            },
            handleCurrentChange(val) {
                console.log(`当前页: ${val}`);
            },
            changeSearchPanelClick(e) {
                this.searchPanelShow = !this.searchPanelShow
            },
        },
        data() {
            return {
                showMoreSearch: false,
                input1: '',
                input2: '',
                input3: '',
                input4: '',
                searchPanelShow: false,
                currentPage4: 4,
                tableData: [{
                    date: '2016-05-02',
                    name: '王小虎',
                    province: '上海',
                    city: '普陀区',
                    address: '上海市普陀区金沙江路 1518 弄',
                    zip: 200333
                }, {
                    date: '2016-05-04',
                    name: '王小虎',
                    province: '上海',
                    city: '普陀区',
                    address: '上海市普陀区金沙江路 1517 弄',
                    zip: 200333
                }, {
                    date: '2016-05-01',
                    name: '王小虎',
                    province: '上海',
                    city: '普陀区',
                    address: '上海市普陀区金沙江路 1519 弄',
                    zip: 200333
                }, {
                    date: '2016-05-03',
                    name: '王小虎',
                    province: '上海',
                    city: '普陀区',
                    address: '上海市普陀区金沙江路 1516 弄',
                    zip: 200333
                }]
            }
        }
    }
</script>

<style scoped>
    .el-row {
        margin-bottom: 10px;
    }

    .tab-content-table-pagination {
        margin-top: 10px;
        text-align: right;
    }

</style>
